﻿#ifndef FANSMONITOR_H
#define FANSMONITOR_H

#include <QMainWindow>
#include <QTcpServer>
#include <QTcpSocket>
#include <QNetworkInterface>
#include <QTimer>

//打包发布时的IP和端口号
#define FIXED_IP "192.168.1.200"
#define FIXED_PORT 2000
//本地测试时的IP和端口号
#define TEST_IP "192.168.242.1"
#define TEST_PORT 200
//定时查询数据和检查连接的周期
#define TIMER_INTERVAL 500
#define RECONNECTION_INTERVAL 2000

namespace Ui {
class FansMonitor;
}

class FansMonitor : public QMainWindow {
    Q_OBJECT

  public:
    explicit FansMonitor(QWidget *parent = nullptr);
    ~FansMonitor();
    //报文组装
    QByteArray packageMessage();
  private slots:

  private:
    Ui::FansMonitor *ui;
    QTcpSocket *client;
    QTcpServer *server;
    QList<QTcpSocket*> clientSocket;
    static int FANS_STATUS;
    static int ELECTRIC_RELAY_STATUS;
    QTimer *queryTimer;
    QTimer *checkLinkTimer;
    bool isOpen;
};

#endif // FANSMONITOR_H
